import { BaseWindow } from "../../../component/window/BaseWindow";
import { ILayer } from "../../../mvc/interfaces/ILayer";
import { Language } from "../../../../extend/language/Language";
import { PetIslandMemberOperVo } from "./vo/PetIslandMemberOperVo";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { SRobIslandPlayer } from "../../../../Message/Game/SRobIslandPlayer";
import { GameDefConfig } from "../../resource/GameDefConfig";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { EGuildPos } from "../../../../Message/Game/EGuildPos";
import { GameConst } from "../../../component/gconst/GameConst";
import { RadioButtonGroup } from "../../../../fl/controls/RadioButtonGroup";
import { ObjCreate } from "../common/ObjCreate";
import { ImagesConst } from "../../resource/ImagesConst";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { GRadioButton } from "../../../../com/mui/controls/GRadioButton";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
import { GButton } from "../../../../com/mui/controls/GButton";
//class PetIslandPosChangePanel
    
    export  class PetIslandPosChangePanel extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            setSize(340, 340);
            titleHeight = 26;
            title = Language.getString(28159);
            return;
        }

        /* internal  */onAffirmHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=new PetIslandMemberOperVo();
            loc1.toPlayerId = this._data.entityId.id;
            loc1.toPosition = int(this._radioGroup.selectedData);
            Dispatcher.dispatchEvent(new DataEvent(EventName.PetIslandMemberOper, loc1));
            return;
        }

        /* internal  */onCancelHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.hide();
            return;
        }

        public setData(arg1: SRobIslandPlayer, arg2: Map<any, any> /* flash.utils.Dictionary */): void
        {
            this._data = arg1;
            var loc1=GameDefConfig.instance.getItem("EGuildPos", arg1.guildPos);
            this._name.htmlText = Language.getStringByParam(28151, HTMLUtil.addColor(arg1.name, loc1.text1));
            this._ownerNum.htmlText = Language.getStringByParam(28156, arg2[EGuildPos._EGuildPosOwner], 1, 80);
            this._captainNum.htmlText = Language.getStringByParam(28156, arg2[EGuildPos._EGuildPosCaptain], 2, 70);
            this._leaderNum.htmlText = Language.getStringByParam(28207, arg2[EGuildPos._EGuildPosLeader], 4, 60);
            this._eliteNum.htmlText = Language.getStringByParam(28239, arg2[EGuildPos._EGuildPosElite], GameConst.RobIslandGuildEliteNum, 40);
            this._memberNum.text = String(arg2[EGuildPos._EGuildPosMember]);
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            this._radioGroup = new RadioButtonGroup("main");
            ObjCreate.createBg(18, 38, 304, 290, this);
            ObjCreate.createBg(30, 120, 280, 2, this, ImagesConst.SplitLine);
            ObjCreate.createBg(30, 165, 280, 2, this, ImagesConst.SplitLine);
            ObjCreate.createBg(30, 210, 280, 2, this, ImagesConst.SplitLine);
            ObjCreate.createBg(30, 255, 280, 2, this, ImagesConst.SplitLine);
            ObjCreate.createGTextField(Language.getString(28152), 65, 79, 100, 28, this);
            this._captainBtn = ObjCreate.createRadioButton(Language.getString(28153), 50, 120, 100, 28, this, "GCheckBox");
            this._captainBtn.value = EGuildPos._EGuildPosCaptain;
            this._captainBtn.group = this._radioGroup;
            this._leaderBtn = ObjCreate.createRadioButton(Language.getString(28154), 50, 165, 100, 28, this, "GCheckBox");
            this._leaderBtn.value = EGuildPos._EGuildPosLeader;
            this._leaderBtn.group = this._radioGroup;
            this._eliteBtn = ObjCreate.createRadioButton(Language.getString(28240), 50, 210, 100, 28, this, "GCheckBox");
            this._eliteBtn.value = EGuildPos._EGuildPosElite;
            this._eliteBtn.group = this._radioGroup;
            this._memberBtn = ObjCreate.createRadioButton(Language.getString(28155), 50, 255, 100, 28, this, "GCheckBox");
            this._memberBtn.value = EGuildPos._EGuildPosMember;
            this._memberBtn.group = this._radioGroup;
            this._name = ObjCreate.createGTextField("", 40, 43, 300, 60, this);
            this._name.mouseEnabled = false;
            this._ownerNum = ObjCreate.createGTextField("", 40, 80, 300, 60, this, GlobalStyle.setTextFormatLeading(GlobalStyle.textFormat1, 5));
            this._ownerNum.mouseEnabled = false;
            this._ownerNum.wordWrap = true;
            this._ownerNum.multiline = true;
            this._captainNum = ObjCreate.createGTextField("", 40, 125, 300, 60, this, GlobalStyle.setTextFormatLeading(GlobalStyle.textFormat1, 5));
            this._captainNum.mouseEnabled = false;
            this._captainNum.wordWrap = true;
            this._captainNum.multiline = true;
            this._leaderNum = ObjCreate.createGTextField("", 40, 170, 300, 60, this, GlobalStyle.setTextFormatLeading(GlobalStyle.textFormat1, 5));
            this._leaderNum.mouseEnabled = false;
            this._leaderNum.wordWrap = true;
            this._leaderNum.multiline = true;
            this._eliteNum = ObjCreate.createGTextField("", 40, 215, 300, 60, this, GlobalStyle.setTextFormatLeading(GlobalStyle.textFormat1, 5));
            this._eliteNum.mouseEnabled = false;
            this._eliteNum.wordWrap = true;
            this._eliteNum.multiline = true;
            this._memberNum = ObjCreate.createGTextField("", 136, 260, 220, 20, this, GlobalStyle.setTextFormatLeading(GlobalStyle.textFormat1, 5));
            this._memberNum.mouseEnabled = false;
            this._memberNum.wordWrap = true;
            this._memberNum.multiline = true;
            this._affirmBtn = ObjCreate.createGButton(Language.getString(28157), 110, 290, 49, 28, this);
            this._affirmBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onAffirmHandler);
            this._cancelBtn = ObjCreate.createGButton(Language.getString(28158), 180, 290, 49, 28, this);
            this._cancelBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onCancelHandler);
            return;
        }

        /* internal */ /* var */_radioGroup: RadioButtonGroup;

        /* internal */ /* var */_captainBtn: GRadioButton;

        /* internal */ /* var */_leaderBtn: GRadioButton;

        /* internal */ /* var */_eliteBtn: GRadioButton;

        /* internal */ /* var */_memberBtn: GRadioButton;

        /* internal */ /* var */_name: GTextFiled;

        /* internal */ /* var */_ownerNum: GTextFiled;

        /* internal */ /* var */_captainNum: GTextFiled;

        /* internal */ /* var */_leaderNum: GTextFiled;

        /* internal */ /* var */_eliteNum: GTextFiled;

        /* internal */ /* var */_memberNum: GTextFiled;

        /* internal */ /* var */_affirmBtn: GButton;

        /* internal */ /* var */_cancelBtn: GButton;

        /* internal */ /* var */_data: SRobIslandPlayer;
    }
